package cn.buk.flight.entity;

import cn.buk.common.util.FlightUtil;
import java.io.Serializable;
import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

@Entity
@Table(name="flightdetail")
public class FlightPrice  {

	@Id
	@GeneratedValue(strategy= GenerationType.IDENTITY)
	private int id;
	
	private int fltid;
	private int b2cHost;
	private int sn;
	
	@Column(length=2)
	private String subclass;
	@Column(length=1)
	private String cabinclass;
	
	@Column(length=20)
	private String subclassdesc;
	
	private int fcny;
	private int scny;
	private int seatCount;
    /**
     * 座位的原始状态
     */
    @Column(length = 2)
    private String seatStatus;
	private int offset;


    /**
     * 返利金额
     */
    @Column(name="rebate_amount")
    private int rebateAmount;

    /**
     * 提前多少天预定
     */
    @Column(name="before_fly_date")
    private int beforeFlyDate;

    /**
     * 更改条件说明
     */
    @Column(name="rer_note")
    private String rernote;

    /**
     * 签转条件
     */
    @Column(name="end_note")
    private String endnote;

    /**
     * 退票条件
     */
    @Column(name="ref_note")
    private String refnote;

    /**
     * 是否允许更改标志
     */
    @Column(name="non_rer")
    private String nonrer;
    /**
     * 是否允许签转标志
     */
    @Column(name="non_end")
    private String nonend;
    /**
     * 是否允许退票标志
     */
    @Column(name="non_ref")
    private String nonref;

	
	@Column(length=500)
	private String b2cBooking;

    @Temporal(TemporalType.TIMESTAMP)
	@Column(insertable = false, updatable = false)
	private Date lastupdate;


    /**
     * 退票费计算公式id
     */
    private int refundFeeFormulaId;
    /**
     * 政策id
     */
    private int policyId;

    private String ticketType;
    private String priceType;
    private String productType;
    private String productSource;
    private String inventoryType;
    private String allowCpType;

    private int canNoDefer;
    //fltData.setCanNoDefer(Boolean.parseBoolean(fltElement.elementText("CanNoDefer")));
    private int onlyOwnCity;
    //fltData.setOnlyOwnCity(Boolean.parseBoolean(fltElement.elementText("OnlyOwnCity")));
    private int lowestCzSpecialPrice;
    //fltData.setLowestCZSpecialPrice(Boolean.parseBoolean(fltElement.elementText("IsLowestCZSpecialPrice")));
    private int lowestPrice;
	
	public String getCabinClassDesc() {
		return FlightUtil.getCabinClassDesc(cabinclass);
	}
	
	public String getOffsetDesc() {
		return FlightUtil.getOffsetDesc(offset);
	}
	

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the b2cHost
	 */
	public int getB2cHost() {
		return b2cHost;
	}

	/**
	 * @param b2cHost the b2cHost to set
	 */
	public void setB2cHost(int b2cHost) {
		this.b2cHost = b2cHost;
	}

	/**
	 * @return the sn
	 */
	public int getSn() {
		return sn;
	}

	/**
	 * @param sn the sn to set
	 */
	public void setSn(int sn) {
		this.sn = sn;
	}

	/**
	 * @return the subclass
	 */
	public String getSubclass() {
        if (subclass == null) {
          return "";
        } else {
          return subclass.trim();
        }
	}

	/**
	 * @param subclass the subclass to set
	 */
	public void setSubclass(String subclass) {
		this.subclass = subclass;
	}

	/**
	 * @return the subclassdesc
	 */
	public String getSubclassdesc() {
		return subclassdesc;
	}

	/**
	 * @param subclassdesc the subclassdesc to set
	 */
	public void setSubclassdesc(String subclassdesc) {
		this.subclassdesc = subclassdesc;
	}

	/**
	 * @return the fcny
	 */
	public int getFcny() {
		return fcny;
	}

	/**
	 * @param fcny the fcny to set
	 */
	public void setFcny(int fcny) {
		this.fcny = fcny;
	}

	/**
	 * @return the scny
	 */
	public int getScny() {
		return scny;
	}

	/**
	 * @param scny the scny to set
	 */
	public void setScny(int scny) {
		this.scny = scny;
	}

	/**
	 * @return the seatcount
	 */
	public int getSeatCount() {
		return seatCount;
	}

	/**
	 * @param seatcount the seatcount to set
	 */
	public void setSeatCount(int seatcount) {
		this.seatCount = seatcount;
	}

	/**
	 * @return the b2cBooking
	 */
	public String getB2cBooking() {
		return b2cBooking;
	}

	/**
	 * @param b2cBooking the b2cBooking to set
	 */
	public void setB2cBooking(String b2cBooking) {
		this.b2cBooking = b2cBooking;
	}

	/**
	 * @return the lastupdate
	 */
	public Date getLastupdate() {
		return lastupdate;
	}

	/**
	 * @param lastupdate the lastupdate to set
	 */
	public void setLastupdate(Date lastupdate) {
		this.lastupdate = lastupdate;
	}

	/**
	 * @return the offset
	 */
	public int getOffset() {
		return offset;
	}

	/**
	 * @param offset the offset to set
	 */
	public void setOffset(int offset) {
		this.offset = offset;
	}

	/**
	 * @return the cabinclass
	 */
	public String getCabinclass() {
		return cabinclass;
	}

	/**
	 * @param cabinclass the cabinclass to set
	 */
	public void setCabinclass(String cabinclass) {
		this.cabinclass = cabinclass;
	}

	public int getFltid() {
		return fltid;
	}

	public void setFltid(int fltid) {
		this.fltid = fltid;
	}

    public String getSeatStatus() {
        return seatStatus;
    }

    public void setSeatStatus(String seatStatus) {
        this.seatStatus = seatStatus;
    }

    public int getRebateAmount() {
        return rebateAmount;
    }

    public void setRebateAmount(int rebateAmount) {
        this.rebateAmount = rebateAmount;
    }

    public int getBeforeFlyDate() {
        return beforeFlyDate;
    }

    public void setBeforeFlyDate(int beforeFlyDate) {
        this.beforeFlyDate = beforeFlyDate;
    }

    public String getRernote() {
        return rernote;
    }

    public void setRernote(String rernote) {
        this.rernote = rernote;
    }

    public String getEndnote() {
        return endnote;
    }

    public void setEndnote(String endnote) {
        this.endnote = endnote;
    }

    public String getRefnote() {
        return refnote;
    }

    public void setRefnote(String refnote) {
        this.refnote = refnote;
    }

    public int getRefundFeeFormulaId() {
        return refundFeeFormulaId;
    }

    public void setRefundFeeFormulaId(int refundFeeFormulaId) {
        this.refundFeeFormulaId = refundFeeFormulaId;
    }

    public int getPolicyId() {
        return policyId;
    }

    public void setPolicyId(int policyId) {
        this.policyId = policyId;
    }

    public String getTicketType() {
        return ticketType;
    }

    public void setTicketType(String ticketType) {
        this.ticketType = ticketType;
    }

    public String getPriceType() {
        return priceType;
    }

    public void setPriceType(String priceType) {
        this.priceType = priceType;
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public String getProductSource() {
        return productSource;
    }

    public void setProductSource(String productSource) {
        this.productSource = productSource;
    }

    public String getInventoryType() {
        return inventoryType;
    }

    public void setInventoryType(String inventoryType) {
        this.inventoryType = inventoryType;
    }

    public String getAllowCpType() {
        return allowCpType;
    }

    public void setAllowCpType(String allowCpType) {
        this.allowCpType = allowCpType;
    }

    public boolean istCanNoDefer() {
        return this.canNoDefer == 1;
    }

    public void setCanNoDefer(boolean canNoDefer) {
        this.canNoDefer = canNoDefer ? 1 : 0;
    }

    public boolean isOnlyOwnCity() {
        return onlyOwnCity == 1;
    }

    public void setOnlyOwnCity(boolean onlyOwnCity) {
        this.onlyOwnCity = onlyOwnCity ? 1 :0;
    }

    public boolean isLowestCzSpecialPrice() {
        return lowestCzSpecialPrice == 1;
    }

    public void setLowestCzSpecialPrice(boolean lowestCzSpecialPrice) {
        this.lowestCzSpecialPrice = lowestCzSpecialPrice ? 1 : 0;
    }

    public boolean isLowestPrice() {
        return lowestPrice == 1;
    }

    public void setLowestPrice(boolean lowestPrice) {
        this.lowestPrice = lowestPrice ? 1 : 0;
    }

    public String getNonrer() {
        return nonrer;
    }

    public void setNonrer(String nonrer) {
        this.nonrer = nonrer;
    }

    public String getNonend() {
        return nonend;
    }

    public void setNonend(String nonend) {
        this.nonend = nonend;
    }

    public String getNonref() {
        return nonref;
    }

    public void setNonref(String nonref) {
        this.nonref = nonref;
    }
}